﻿/*
MOVIES App - catolog & rating,  our collection of VHS/DVD/Digital Downloads 

*/
var myApp = angular.module('myMovies', ['ngRoute','ui.bootstrap']);

// routing...
// add dependancy of route provider. Add the name, folled the object
myApp.config(['$routeProvider', function ($routeProvider) {
    // when the user types something in the Address bar
    // they will land on one following options...
    // i.e. /about              = http://myCoolSite.com/about
    // i.e. /movie/:movieId     =  http://myCoolSite.com/movie/2
    $routeProvider
      .when('/', {
          controller: 'MoviesController',
          templateUrl: 'app/views/home.html'
      })
    .when('/about', {
        controller: 'MoviesController',
        templateUrl: 'app/views/about.html'
    })
        .when('/movie/:movieId', { // when this is in the Address Bar, serve up the DetailsController & details.html
            controller: 'DetailsController',
            templateUrl: 'app/views/details.html'
        })
        .when('/posts/:articleId', {
            controller: 'ArticleController',
            templateUrl: 'app/views/article.html'
        })

        .otherwise({
        // if any other path/route in Address, redirect...
        redirectTo: '/'
    });



}]);